<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/all.conf.php');
require_once(__PHY_LIB.'/inc/page.user.inc.php');
require_once(__PHY_LIB.'/class/uWork.class.php');
require_once(__PHY_LIB.'/class/FnOrder.class.php');
require_once(__PHY_LIB.'/func/Cart.func.php');
require_once(__PHY_LIB.'/func/Shipping.func.php');
require_once(__PHY_LIB.'/func/Payment.func.php');

/// 初始化 ///
$rReq = validate($_REQUEST, 'action:e[none,confirm]');
$rMsg = array();

if ('confirm' == $sAction) {
	do {
		$rP = validate($_POST, 'order:n');
	} while (false);
}

/// 订单信息 ///
$rP = validate($_GET, 'order:n');
$oOrder = new Order($rP['order']);
if (!($oOrder->get('owner_type') == $_The['UserType'] && $oOrder->get('owner_id') == $_The['User']['id'])) { die('access denied.'); }
$oTpl->assign('rOrder', $oOrder->getData());
/// 商品列表 ///
$oList = new uWorkList("fnnc_order_work ow"
	. " INNER JOIN unit_work w ON w.id=ow.work_id"
	. " INNER JOIN unit_work_size s ON s.id=ow.size_id");
$oList->cfgField("w.*,ow.size_id,ow.kuang_id,ow.quantity,s.title AS size_title,s.title_en AS size_title_en");
$oList->cfgWhere("ow.order_id='{$rP['order']}'");
$oList->cfgOrder("ow.id");
$oList->load();
$oTpl->assign('rWorks', $oList->fetchArray());

$oTpl->assign('rMsg', $rMsg);
$oTpl->display(dirname(__FILE__).'/'.basename(__FILE__, '.php').'.tpl');
?>
